package com.xyht.sca_s.student_manage_system.modules.examinePaymentEquipment.config;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xyht.sca_s.student_manage_system.modules.examinePaymentEquipment.entity.SmsPaymentExamineEquipmentProcurementProcess;
import com.xyht.sca_s.student_manage_system.modules.examinePaymentEquipment.mapper.SmsPaymentExamineEquipmentProcurementProcessMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class ExamineInit {
    @Autowired
    private SmsPaymentExamineEquipmentProcurementProcessMapper smsPaymentExamineEquipmentProcurementProcessMapper;

//    private String[] departmentNameArray = {"后勤部门", "使用部门", "经办人",
//            "后勤处分管副院长", "财务部", "院长", "理事长"};
    private String[] departmentNameArray = {"后勤部门", "使用部门",
            "后勤处分管副院长", "财务部", "院长", "理事长"};

    @Bean
    public void examinePaymentEquipmentInit() {
        List<SmsPaymentExamineEquipmentProcurementProcess> processList =
                smsPaymentExamineEquipmentProcurementProcessMapper.selectList(new QueryWrapper<>());
        if (processList == null || processList.size() < 1) {
            int sort = 1;
            for (String departmentName : departmentNameArray) {
                SmsPaymentExamineEquipmentProcurementProcess addProcess =
                        new SmsPaymentExamineEquipmentProcurementProcess();
                addProcess.setProcessName(departmentName);
                addProcess.setProcessIsUse(true);
                addProcess.setProcessIsStamp(false);
                addProcess.setProcessIsSign(true);
                addProcess.setProcessIsApplicantEdit(false);
                addProcess.setProcessSort(sort++);
                smsPaymentExamineEquipmentProcurementProcessMapper.insert(addProcess);
            }


        }
    }


}
